import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import autoImport from 'unplugin-auto-import/vite'
 
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    uni(),
    autoImport({
      imports: ['vue', 'uni-app', 'pinia'],
      dts: 'src/auto-imports.d.ts',
    })
  ],
  build: {
    commonjsOptions: {
      // 强制将以下依赖转为 CommonJS 并转译
      transformMixedEsModules: true,
      include: [/pinia/, /vuex/, /axios/, /dayjs/],
    },
    // 添加 rollupOptions 排除外部化
    rollupOptions: {
      external: [],
    },
  }
})
